 
import { cache_key_arg0, cache_return } from "utils/decorate/decorate";
import { roomCostStrategy } from "./BaseCostStrategy"
 
export class roomCostStrategyOfCreepNormal extends roomCostStrategy
{
    // @cache_return("cache",0,cache_key_arg0)
    public getCost(roomName:string):CostMatrix
    {
        const room = Game.rooms[roomName]
        // 房间没有视野
        if (!room)
        {
            let tmpcosts =  new PathFinder.CostMatrix()
            const station = global.world.PollStructure(roomName);
            if(station)
            {
                tmpcosts = station.getCostMatrix();
            }
            return tmpcosts;
        }

        let costs:CostMatrix  =  new PathFinder.CostMatrix();      
        if(room.IsFriend())
        {
            const sites =  room.find(FIND_CONSTRUCTION_SITES);
            if(sites)
            {
                // 无法行走的工地
                sites.forEach(item=>{
                    if((item.structureType == STRUCTURE_ROAD)||
                    (item.structureType == STRUCTURE_CONTAINER)|| (item.structureType ==STRUCTURE_RAMPART))
                    {
                    }
                    else
                    {
                        costs.set(item.pos.x, item.pos.y, 0xff)
                    }
                });
            }
        }
        return costs;
    }
}
